class Eventemitter {
  constructor() {
    this.events = {}
  }
  emit(event, ...args) {
    const cbs = this.events[event]
    if (cbs && cbs.length > 0) {
      cbs.forEach(cb => cb.apply(this, args))
    }
    return this
  }
  on(event, cb) {
    if (!this.events[event]) {
      this.events[event] = []
    }
    this.events[event].push(cb)
    return this
  }
  once(event, cb) {
    const func = (...args) => {
      this.off(event, func)
      cb.apply(this, args)
    }
    this.on(event, func)
    return this
  }
  off(event, cb) {

  }
}

const event = new Eventemitter()

// console.log(this)
// console.log(global)

var reg = /[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/g
var regExp = new RegExp(reg)
var text = '2021-08-03000'
text = text.replace(reg,function($,$1) {
  console.log($)
  console.log($1)
  return $+ ' '
})
console.log(text)

